package com.industrial.premu.controller;

import com.industrial.common.core.utils.poi.ExcelUtil;
import com.industrial.common.core.web.controller.BaseController;
import com.industrial.common.core.web.domain.AjaxResult;
import com.industrial.common.core.web.page.TableDataInfo;
import com.industrial.common.log.annotation.Log;
import com.industrial.common.log.enums.BusinessType;
import com.industrial.premu.domain.PreMuCountyTaxJl;
import com.industrial.premu.service.IPreMuCountyTaxJlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 区县导入数据记录Controller
 *
 * @author SangGuangCan
 * @date 2024-05-21
 */
@RestController
@RequestMapping("/county/import/jl")
public class PreMuCountyTaxJlController extends BaseController
{
    @Autowired
    private IPreMuCountyTaxJlService preMuCountyTaxJlService;

    /**
     * 查询区县导入数据记录列表
     */
    @GetMapping("/list")
    public TableDataInfo list(PreMuCountyTaxJl preMuCountyTaxJl)
    {
        startPage();
        List<PreMuCountyTaxJl> list = preMuCountyTaxJlService.selectPreMuCountyTaxJlList(preMuCountyTaxJl);
        return getDataTable(list);
    }

    /**
     * 导出区县导入数据记录列表
     */
    @Log(title = "区县导入数据记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PreMuCountyTaxJl preMuCountyTaxJl)
    {
        List<PreMuCountyTaxJl> list = preMuCountyTaxJlService.selectPreMuCountyTaxJlList(preMuCountyTaxJl);
        ExcelUtil<PreMuCountyTaxJl> util = new ExcelUtil<PreMuCountyTaxJl>(PreMuCountyTaxJl.class);
        util.exportExcel(response, list, "区县导入数据记录数据");
    }

    /**
     * 获取区县导入数据记录详细信息
     */
    @GetMapping(value = "/{baseId}")
    public AjaxResult getInfo(@PathVariable("baseId") String baseId)
    {
        return success(preMuCountyTaxJlService.selectPreMuCountyTaxJlByBaseId(baseId));
    }

    /**
     * 新增区县导入数据记录
     */
    @Log(title = "区县导入数据记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PreMuCountyTaxJl preMuCountyTaxJl)
    {
        return toAjax(preMuCountyTaxJlService.insertPreMuCountyTaxJl(preMuCountyTaxJl));
    }

    /**
     * 修改区县导入数据记录
     */
    @Log(title = "区县导入数据记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PreMuCountyTaxJl preMuCountyTaxJl)
    {
        return toAjax(preMuCountyTaxJlService.updatePreMuCountyTaxJl(preMuCountyTaxJl));
    }

    /**
     * 删除区县导入数据记录
     */
    @Log(title = "区县导入数据记录", businessType = BusinessType.DELETE)
    @DeleteMapping("/{baseIds}")
    public AjaxResult remove(@PathVariable String[] baseIds)
    {
        return toAjax(preMuCountyTaxJlService.deletePreMuCountyTaxJlByBaseIds(baseIds));
    }
}